#include "../include/tcp.server.h"

int change(char *s)
{
    int tmp = 0;
    if ((strcmp(s, "REG") == 0) || strcmp(s, "reg")==0)
    {
        tmp = REGISTER;
    }
    else if ((strcmp(s, "LOG") == 0) || strcmp(s, "log")==0)
    {
        tmp = LOGIN;
    }
    else if(strcmp(s,"ADD")== 0)
    {
        tmp = ADD;
    }
    else if(strcmp(s,"SEE")== 0)
    {
        tmp = SEE;
    }
    else if(strcmp(s,"SEARCH")== 0)
    {
        tmp = SEARCH;
    }
    else if(strcmp(s,"DELETE")== 0)
    {
        tmp = DELETE;
    }
    else if(strcmp(s,"UPDATE")== 0)
    {
        tmp = UPDATE;
    }
    else if((strcmp(s, "Y")) == 0 || (strcmp(s, "y")) == 0)
    {
        tmp = Y;
    }
    else if((strcmp(s, "N")) == 0 || (strcmp(s, "n")) == 0)
    {
        tmp = N;
    }
    else if(strcmp(s,"EXIT")== 0)
    {
        tmp = EXIT;
    }
    else
    {
        return ERROR;
    }
    return tmp;

}